package com.heaven.config.saToken;

import cn.dev33.satoken.reactor.spring.SaTokenContextForSpringReactor;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import org.springframework.util.AntPathMatcher;

/**
 * 自定义 SaTokenContext 实现类，重写 matchPath 方法，切换为 ant_path_matcher 模式，使之可以支持 `**` 之后再出现内容
 */
@Primary
@Component
public class SaTokenContextByPatternsRequestCondition extends SaTokenContextForSpringReactor {

    @Override
    public boolean matchPath(String pattern, String path) {
        return new AntPathMatcher().match(pattern, path);
    }

}